import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 导出所有图标组件
export const icons = ElementPlusIconsVue

// 图标名称映射表（将后端返回的图标名称映射到Element Plus图标组件名称）
export const iconNameMap: Record<string, string> = {
  'el-icon-house': 'House',
  'el-icon-s-tools': 'Tools',
  'el-icon-user': 'User',
  'el-icon-s-custom': 'Avatar',
  'el-icon-menu': 'Menu',
  'el-icon-plus': 'Plus',
  'el-icon-refresh': 'Refresh',
  'el-icon-search': 'Search',
  'el-icon-edit': 'Edit',
  'el-icon-delete': 'Delete',
  'el-icon-view': 'View',
  'el-icon-setting': 'Setting',
  'el-icon-lock': 'Lock',
  'el-icon-unlock': 'Unlock',
  'el-icon-download': 'Download',
  'el-icon-upload': 'Upload',
  'el-icon-share': 'Share',
  'el-icon-star': 'Star',
  'el-icon-message': 'Message',
  'el-icon-notification': 'Notification',
  'el-icon-bell': 'Bell',
  'el-icon-home': 'Home',
  'el-icon-location': 'Location',
  'el-icon-position': 'Position',
  'el-icon-map': 'Map',
  'el-icon-document': 'Document',
  'el-icon-folder': 'Folder',
  'el-icon-folder-opened': 'FolderOpened',
  'el-icon-picture': 'Picture',
  'el-icon-camera': 'Camera',
  'el-icon-video-camera': 'VideoCamera',
  'el-icon-microphone': 'Microphone',
  'el-icon-phone': 'Phone',
  'el-icon-mobile': 'Mobile',
  'el-icon-computer': 'Monitor',
  'el-icon-printer': 'Printer',
  'el-icon-shopping-cart': 'ShoppingCart',
  'el-icon-shopping-bag': 'ShoppingBag',
  'el-icon-coin': 'Coin',
  'el-icon-wallet': 'Wallet',
  'el-icon-credit-card': 'CreditCard',
  'el-icon-bank-card': 'BankCard',
  'el-icon-ticket': 'Ticket',
  'el-icon-discount': 'Discount',
  'el-icon-price-tag': 'PriceTag',
  'el-icon-goods': 'Goods',
  'el-icon-present': 'Present',
  'el-icon-box': 'Box',
  'el-icon-ship': 'Ship',
  'el-icon-truck': 'Truck',
  'el-icon-bicycle': 'Bicycle',
  'el-icon-car': 'Car',
  'el-icon-bus': 'Bus',
  'el-icon-subway': 'Subway',
  'el-icon-train': 'Train',
  'el-icon-plane': 'Plane',
  'el-icon-sunny': 'Sunny',
  'el-icon-cloudy': 'Cloudy',
  'el-icon-rainy': 'Rainy',
  'el-icon-snowy': 'Snowy',
  'el-icon-windy': 'Windy',
  'el-icon-thunderstorm': 'Thunderstorm',
  'el-icon-moon': 'Moon',
  'el-icon-sunrise': 'Sunrise',
  'el-icon-sunset': 'Sunset',
  'el-icon-umbrella': 'Umbrella',
  'el-icon-alarm-clock': 'AlarmClock',
  'el-icon-watch': 'Watch',
  'el-icon-stopwatch': 'Stopwatch',
  'el-icon-timer': 'Timer',
  'el-icon-calendar': 'Calendar',
  'el-icon-date': 'Date',
  'el-icon-time': 'Clock',
  'el-icon-attention': 'Warning',
  'el-icon-warning': 'WarningFilled',
  'el-icon-question': 'QuestionFilled',
  'el-icon-info': 'InfoFilled',
  'el-icon-close': 'Close',
  'el-icon-check': 'Check',
  'el-icon-minus': 'Minus',
  'el-icon-arrow-up': 'ArrowUp',
  'el-icon-arrow-down': 'ArrowDown',
  'el-icon-arrow-left': 'ArrowLeft',
  'el-icon-arrow-right': 'ArrowRight',
  'el-icon-d-arrow-left': 'DArrowLeft',
  'el-icon-d-arrow-right': 'DArrowRight',
  'el-icon-back': 'Back',
  'el-icon-right': 'Right',
  'el-icon-top': 'Top',
  'el-icon-bottom': 'Bottom',
  'el-icon-sort': 'Sort',
  'el-icon-sort-up': 'SortUp',
  'el-icon-sort-down': 'SortDown',
  'el-icon-rank': 'Rank',
  'el-icon-caret-left': 'CaretLeft',
  'el-icon-caret-right': 'CaretRight',
  'el-icon-caret-top': 'CaretTop',
  'el-icon-caret-bottom': 'CaretBottom',
  'el-icon-d-caret': 'DCaret',
  'el-icon-expand': 'Expand',
  'el-icon-fold': 'Fold',
  'el-icon-zoom-in': 'ZoomIn',
  'el-icon-zoom-out': 'ZoomOut',
  'el-icon-full-screen': 'FullScreen',
  'el-icon-crop': 'Crop',
  'el-icon-scissors': 'Scissors',
  'el-icon-filter': 'Filter',
  'el-icon-magic-stick': 'MagicStick',
  'el-icon-brush': 'Brush',
  'el-icon-pen': 'EditPen',
  'el-icon-connection': 'Connection',
  'el-icon-link': 'Link',
  'el-icon-cloud-upload': 'UploadFilled',
  'el-icon-cloud-download': 'DownloadFilled',
  'el-icon-upload2': 'Upload',
  'el-icon-download2': 'Download',
}

// 获取图标组件的函数
export const getIconComponent = (iconName: string) => {
  const mappedName = iconNameMap[iconName]
  if (mappedName && icons[mappedName as keyof typeof icons]) {
    return icons[mappedName as keyof typeof icons]
  }
  return null
}
